﻿
@{
    Layout = "";
}
<div ng-controller="ActivityInfoController">
    <div class="f_mb60">
        <!-- 轮播图 -->
        <div>
            <carousel interval="myInterval">
                <slide ng-repeat="slide in slides" active="slide.active">
                    <a href="javascript:void(0)"><img ng-src="{{slide.image}}" style="margin: auto;" alt="" /></a>
                </slide>
            </carousel>
        </div>
        <!-- 轮播图结束 -->
        <!-- 一分钱商品信息 -->
        <div class="flayout_d_proInfoBox">
            <p class="flayout_d_proName">{{model.ActivityName}}</p>
            <div class="flayout_d_row">
                @*<p class="flayout_d_row_half"><span class="flayout_d_tag">礼盒6袋</span><span class="flayout_d_tag">包邮</span></p>*@
                <p class="flayout_d_row_half flayout_d_time ftz_time_part" style="width:200px" EndTime="{{model.EndTime}}"></p>
            </div>
            <div class="flayout_d_row">
                <p class="flayout_d_row_half"><span class="flayout_d_priceSymbol">¥</span><label class="flayout_d_price">{{model.ActivityPrice}}</label></p>
                <p class="flayout_d_row_half flayout_d_sold">已拼{{model.TeamCount}}件</p>
            </div>

        </div>
        <p class="flayout_d_explain">没有抽到奖品的，退款；组团失败：退款</p>
        <!--end 一分钱商品信息 -->
        <!-- 一分钱拼团玩法 -->
        <div class="flayout_d_how_to_play">
            <p class="flayout_d_playhd">1分钱玩法</p>
            <div class="flayout_d_playbox">
                <img src="/Content/images/f_39.png" alt="">
            </div>
        </div>
        <!--end 一分钱拼团玩法 -->
        <!-- 商品详情 -->
        <div class="flayout_d_prodetail">
            <h3><img src="/Content/images/f_36.png" alt="商品详情">商品详情</h3>
            <div class="flayout_d_prodetails">
                {{model.ActivityDetails}}
            </div>
        </div>
        <!--end 商品详情 -->
    </div>
    <!-- 底部 -->
    <div class="flayout_d_bottom">
        <ul>
            <li class="li1 active">
                <a href="javascript:void(0)" ui-sref="activity.index">
                    <img src="/Content/images/pt_1a.png">
                    <p>拼团活动</p>
                </a>
            </li>
            <li class="li2">
                <p class="p1"><span>¥</span>{{model.ActivityPrice}}</p>
                <p class="p2">已购买{{model.TeamCount}}份</p>
            </li>
            <li class="li3" ng-show="isend==0">
                <a href="javascript:void(0)" ng-click="goopen(model.Id)"><button type="button" class="libtn">立即抢购</button></a>
            </li>
        </ul>
    </div>
    <!--end 底部 -->

    <img src="/Content/images/pf_gz.png" alt="扫码关注" class="animated pf_gzImg swing  infinite" />
    <!--end 提示关注的漂浮菜单 -->
    <!-- 弹出二维码 -->
    <div class="f_popBox"></div>
    <div class="f_popMain">
        <div class="imgBox"><img src="/Content/images/sc_ewm1.png" alt="" /></div>
        <div class="szimg"><img src="/Content/images/sm_zw.png" alt="" /><span>扫一扫，关注公众号</span></div>
    </div>
    <!--end 弹出二维码 -->

</div>
<script>
    var isendnotime = 0;

    App.controller('ActivityInfoController', [
           '$scope', '$http', '$rootScope', '$stateParams', '$state', '$filter',
       function ($scope, $http, $rootScope, $stateParams, $state, $filter) {
           $scope.isend = 0;
           $scope.nowtime = new Date();
           $scope.model = {};
           $http.post("/Activity/GetVActivityInfo", { id: $stateParams.Id }).then(function (response) {
               if (response.data.Result && response.data.Result != "") {
                   $scope.model = response.data.Result;
                   var endtime = new Date($scope.model.EndTime.replace(/-/g, '/'));
                   debugger
                   if ($scope.nowtime > endtime || $scope.model.ActivityStatus != 0) {
                       layer.msg("该活动已结束！");
                       $scope.isend = 1;
                       isendnotime = 1;
                   }

                   // 设置轮播图图片间隔
                   $scope.myInterval = 5000;
                   // 轮播图数据初始化
                   var slides = $scope.slides = [];
                   // 添加轮播图源
                   slides.push({ image: $rootScope.ImgHostUrl + response.data.Result.CoverImg });

               }
           });


           $scope.goopen = function (id) {
               debugger
               $state.go('shop.actorder', { "activityId": id, "groupId": 0 });
           }

           var tt = function () {
               $rootScope.WxShare($rootScope.pageTitle(), '优品三悦', location.href, $rootScope.LogoUrl);
           }

           setTimeout(tt, 1000)
       }]);


    function GetRTime() {
        if (isendnotime == 1) {
            $(".ftz_time_part").each(function () {
                $(this).html("活动已结束");
            })
        } else {
            $(".ftz_time_part").each(function () {
                var e = $(this).attr("EndTime").replace(/-/g, '/');

                var EndTime = new Date(e);

                var NowTime = new Date();
                var t = EndTime.getTime() - NowTime.getTime();
                var d = 0;
                var h = 0;
                var m = 0;
                var s = 0;
                if (t >= 0) {
                    d = Math.floor(t / 1000 / 60 / 60 / 24);
                    h = Math.floor(t / 1000 / 60 / 60 % 24);
                    m = Math.floor(t / 1000 / 60 % 60);
                    s = Math.floor(t / 1000 % 60);
                }
                var timetxt = "距结束&nbsp;&nbsp;";
                if (d > 0) {
                    timetxt += d + "天";
                }
                if (h > 0) {
                    if (h < 10) {
                        h = "0" + h;
                    }
                    timetxt += " " + h + "小时";
                }
                if (m > 0) {
                    if (m < 10) {
                        m = "0" + m;
                    }
                    timetxt += "：" + m + "分";
                }
                if (s > 0) {
                    if (s < 10) {
                        s = "0" + s;
                    }
                    timetxt += "：" + s + "秒";
                }
                if (timetxt == "距结束&nbsp;&nbsp;") {
                    timetxt = "活动已结束！";
                }
                $(this).html(timetxt);
            })
        }
    }

    setInterval('GetRTime()', 1000);


    $('.f_popMain').center();

    $('.pf_gzImg').click(function () {
        $('.f_popBox').show();
        $('.f_popMain').show();
    });
    $('.f_popBox').click(function () {
        $('.f_popBox').hide();
        $('.f_popMain').hide();

    });


</script>
